<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="${ctxPath}/js/jquery-1.9.1.min.js"></script>
    <script>
        function check(){
            var $goid = $("input[type=radio]:checked");
            var key = $("#key").val();
            var $1 = $($goid[0]);
            var $2 = $($goid[1]);
            var id = $1.val();
            var goButton = $1.siblings("input").val();
            var id2 = $2.val();
            var comButton = $2.siblings("input").val();
            var trip = $("#trip").val();
            var vo = {"goId":id,"comId":id2,"key":key,"goButton":goButton,"comButton":comButton,"trip":trip};
            //alert(comButton+" "+goButton);
            $.post("/chooseFlight/",vo,function (data) {
                alert(data)
            })
        }
    </script>
    <link rel="stylesheet" href="${ctxPath}/bootstrap/css/bootstrap.css">
</head>
<body>
<h1>出发航班</h1>
<input type="hidden" id="key" value="${key}">
<hr/>
<table class="table table-hover">
    <tr>
        <th width="120">航班日期</th>
        <th width="120">起飞时间</th>
        <th width="120">预计到达</th>
        <th width="120">详情</th>
        <th width="200">Promo</th>
        <th width="200">Eco</th>
        <th width="200">SkyBoss</th>
    </tr>
    <% for(entry in list[0]){
        var key = entry.key;
        var air = entry.value;
    %>
    <tr>
        <td>${air.flightDate}</td>
        <td>${air.departureTime}</td>
        <td>${air.timeOfArrival}</td>
        <td>${air.flightDetails}</td>
        <td>
            <%
            if(air.promo!=null){
            %>
            <input name="comId" type="radio" value="${key}" class="id">
            <input type="hidden" name="key" value="${air.promo.comeButton}">
            ${air.promo}
            <%
            }
            %>
        </td>
        <!--<td><input name="id" type="radio" value="${key}" class="id"><input type="hidden" value="${air.key}">${air.promo}</td>-->
        <td><input name="goId" type="radio" value="${key}" class="id"><input type="hidden" value="${air.eco.goButton}">${air.eco}</td>
        <td><input name="goId" type="radio" value="${key}" class="id"><input type="hidden" value="${air.skyBoss.goButton}">${air.skyBoss}</td>
    </tr>
    <% } %>
</table>
<hr/>
<button type="button" onclick="check()" class="btn btn-default">扣位</button>
<h1>返回航班</h1>
<hr/>
<table class="table table-hover">
    <tr>
        <th width="120">航班日期</th>
        <th width="120">起飞时间</th>
        <th width="120">预计到达</th>
        <th width="120">详情</th>
        <th width="200">Promo</th>
        <th width="200">Eco</th>
        <th width="200">SkyBoss</th>
    </tr>
    <% for(entry in list[1]){
        var key = entry.key;
        var air = entry.value;
    %>
    <tr>
        <td>${air.flightDate}</td>
        <td>${air.departureTime}</td>
        <td>${air.timeOfArrival}</td>
        <td>${air.flightDetails}</td>
        <td>
            <%
                if(air.promo!=null){
            %>
            <input name="comId" type="radio" value="${key}" class="id">
            <input type="hidden" name="key" value="${air.promo.comeButton}">
            ${air.promo}
            <%
                }
            %>
        </td>
        <td><input name="comId" type="radio" value="${key}" class="id"><input type="hidden" name="key" value="${air.eco.comeButton}">${air.eco}</td>
        <td><input name="comId" type="radio" value="${key}" class="id"><input type="hidden" name="key" value="${air.skyBoss.comeButton}">${air.skyBoss}</td>
    </tr>
    <% } %>
</table>
</body>
</html>